package com.crape.topic.dao.impl;

import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.crape.common.exceptions.DAOException;
import com.crape.common.ibatis.SqlMapClientDaoSupportEx;
import com.crape.common.model.ArticleRecommend;
import com.crape.topic.dao.IArticleRecommendDAO;

@Service
public class ArticleRecommendDAOImpl extends SqlMapClientDaoSupportEx implements IArticleRecommendDAO {

	@Override
	public ArticleRecommend getArticleRecommend(Long accountid, Long articleid) throws DAOException {
		if(accountid==null||articleid==null){
			return null;
		}
		Map<String,Object> params = new HashMap<String,Object>();
		params.put("accountid", accountid);
		params.put("articleid", articleid);
		return (ArticleRecommend) this.queryObject("getArticleRecommend", params);
	}

	@Override
	public void insertArticleRecommend(Long accountid, Long articleid) throws DAOException {
		if(accountid==null||articleid==null){
			return ;
		}
		Map<String,Object> params = new HashMap<String,Object>();
		params.put("accountid", accountid);
		params.put("articleid", articleid);
		this.insert("insertArticleRecommend", params);
	}

	@Override
	public void updateArticleRecommend(Long accountid, Long articleid) throws DAOException {
		if(accountid==null||articleid==null){
			return ;
		}
		Map<String,Object> params = new HashMap<String,Object>();
		params.put("accountid", accountid);
		params.put("articleid", articleid);
		this.update("updateArticleRecommend", params);
	}

}
